unit Kilit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, FormClass, XPMan, StdActns, ActnList, StdCtrls, Buttons;

type
  TfmKilit = class(TfmFormClass)
    passwordk: TEdit;
    StaticText1: TStaticText;
    aclist: TActionList;
    Action1: TAction;
    Action2: TAction;
    StaticText2: TStaticText;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCanResize(Sender: TObject; var NewWidth,
      NewHeight: Integer; var Resize: Boolean);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Action1Execute(Sender: TObject);
    procedure passwordkKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmKilit: TfmKilit;

implementation
uses math, data, ana1;
{$R *.dfm}

procedure TfmKilit.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  inherited;
  Action := caFree;
  fmKilit := nil;
end;

procedure TfmKilit.FormCanResize(Sender: TObject; var NewWidth,
  NewHeight: Integer; var Resize: Boolean);
begin
  inherited;
  if Tag = 1 then
  begin
    Resize := False;
  end
  else
  begin
    passwordk.Left := Ceil((NewWidth - passwordk.Width) / 2);
    passwordk.Top := Ceil((NewHeight - passwordk.Height) / 2);

    StaticText1.Left := passwordk.Left;
    StaticText1.Top := passwordk.Top - (StaticText1.Height + 2);

    StaticText2.Left := passwordk.Left;
    StaticText2.Top := StaticText1.Top - (StaticText2.Height + 2);
  end;
end;

procedure TfmKilit.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if (ssShift in Shift) or
    (ssCtrl in Shift) or
    (ssAlt in Shift) then
  begin
    Shift := [];
    Key := 0;
  end;
  inherited;
end;

procedure TfmKilit.Action1Execute(Sender: TObject);
begin
  inherited;
  passwordk.SetFocus;
end;

procedure TfmKilit.passwordkKeyPress(Sender: TObject; var Key: Char);
begin
  inherited;
  if (Key = #13) and
    (UpperCase_Turk(Trim(passwordk.Text)) = UpperCase_Turk(Trim(dm.sifrekontrol.FieldByName('Password').AsString)))
    then
  begin
    anaform.Menu := anaform.MainMenu1;
    anaform.AutoScroll := True;
    anaform.HorzScrollBar.Visible := True;
    anaform.VertScrollBar.Visible := True;
    anaform.ControlBar.Enabled := True;
    anaform.ControlBar.Visible := True;
    anaform.Panel2.Visible := True;
    Close;
  end;
end;

end.

